<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
	<title>代理层</title>
  </head>
  
  <body>
   <img src="/static/loading.gif" alt="页面无法加载"> <br>
   	 代理................ 页面正在加载中，请稍候……
   	 <input type="hidden"  value="${askurl}" id="askurl">
   	 <input type="hidden"  value="${askData}"  id="askData">
   	 <input type="hidden"  value="${okurl}"  id="okurl">
  </body>
  <script type="text/javascript">
   /* 	var askurl= "http://sso.test.com/replylogin.html";
  		var askData= null ;
  		var okurl= "http://my.web.com:8080/oklogin.html"; 
  	*/
	var askurl=$("#askurl").val();
	var askData=$("#askData").val()==undefined ?null:$("#askData").val();
	var okurl=$("#okurl").val();
	function proxyLogin(askurl, askData, okurl) {
		console.log(askurl);
		console.log(askData);
		console.log(okurl);
	    var killAjax = true;
	    setTimeout(function() {
	        checkajaxkill();
	    }, 30000);
	    var ajaxCall = jQuery.getJSON(askurl + "?callback=?", {askData:askData}, function(d){
	    	killAjax = false;
	    	if(d.msg == "-1"){
		    	window.location.href = "http://sso.test.com/login.html?ReturnURL=http%3A%2F%2Fmy.web.com%3A8080%2Fproxylogin.html";
	    	}else{
	    		console.log(d.msg)
	    		$.post(okurl, {replyTxt:d.msg} , function(e) {
		    		window.location.href = e.returl;
			    }, "json");
	    	}
	    });
	    function checkajaxkill(){
	        if(killAjax){
	        	ajaxCall.abort();
	        	window.location.href = "http://my.web.com:8080/timeout.html";
	        }
	    }
	}
	proxyLogin( askurl,askData,okurl);
</script>
</html>